package me.kuye.jkuye.config;

import java.io.File;
import java.util.Properties;

import me.kuye.jkuye.core.Const;
import me.kuye.jkuye.helper.PropHelper;
import me.kuye.jkuye.util.PropUtil;

public abstract class JKuyeConfig {
	public abstract void configConstant(Constants constants);

	public abstract void configPlugin(Plugins plugins);

	public abstract void configInterceptor(Interceptors interceptors);

	public abstract void configHandler(Handlers handlers);

	public abstract void configRoute(Routes routes);

	public void afterStart() {
	};

	public void beforeStop() {
	};

	protected PropUtil propUtils;

	public Properties getPropertiesByFile(String fileName) {
		return getPropertiesByFile(fileName, Const.DEFAULT_ENCODING);
	}

	public Properties getPropertiesByFile(String fileName, String encoding) {
		propUtils = PropHelper.getUtils(fileName, encoding);
		return propUtils.getProperties();
	}

	public Properties getPropertiesByFile(File file) {
		return getPropertiesByFile(file, Const.DEFAULT_ENCODING);
	}

	public Properties getPropertiesByFile(File file, String encoding) {
		propUtils=PropHelper.getUtils(file,encoding);
		return propUtils.getProperties();
	}

	
}
